<template>
  <div class="video-container">
    <h1>推荐MV <span class="el-icon-arrow-right"></span> </h1>

    <div class="mv-list">
      <div class="mv-item" v-for="item in mv" :key="item.id">
        <div class="mv-img" @click="$router.push('/mv/' + item.id)">
          <img :src="item.picUrl">
          <span class="el-icon-caret-right">{{ item.playCount }}</span>
          <div class="mask">最新热门MV推荐</div>
        </div>
        <p>{{ item.name }}</p>
        <span class="mv-ceartor" @click="$router.push('/artists/' + item.artistId)">{{ item.artistName }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import axios from '@/request/request'
export default {
  data() {
    return {
      mv: []
    }
  },
  created() {
    this.getMvList()
  },
  methods: {
    async getMvList() {
      const { data: res } = await axios.get('/personalized/mv')
      if (res.code == 200) {
        this.mv = res.result
      }
    }
  }
}
</script>

<style lang="less" scoped>
.video-container {
  width: 100%;
  margin-top: 20px;
  cursor: default;

  h1 {
    margin: 0;
    font-size: 20px;
    text-align: start;
    color: #fff;

    span {
      font-size: 20px;
    }
  }

  .mv-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;

    .mv-item {
      width: 250px;
      height: 185px;
      text-align: start;
      margin-bottom: 20px;

      .mv-img {
        position: relative;
        width: 100%;
        height: 140px;
        border-radius: 4px;
        overflow: hidden;

        &:hover .mask {
          top: 0;
        }

        img {
          width: 100%;
          height: 100%;
          transition: all 0.5s;

          &:hover {
            transform: scale(1.2);
          }
        }

        span {
          position: absolute;
          top: 8px;
          right: 8px;
          color: #fff;
          font-size: 12px;
        }

        .mask {
          position: absolute;
          top: -40px;
          left: 0;
          width: 100%;
          height: 40px;
          text-align: start;
          padding-left: 5px;
          font-size: 14px;
          line-height: 40px;
          background-color: rgba(0, 0, 0, 0.7);
          color: #fff;
          transition: all 0.5s;
        }
      }

      p {
        width: 100%;
        margin: 0;
        font-size: 14px;
        margin-top: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #fff;
      }

      .mv-ceartor {
        color: rgb(228, 228, 228);
        font-size: 12px;
      }
    }
  }
}
</style>